feat: add regex support to trusted-origins#7697
Merged
code-asher merged 3 commits intocoder:mainfrom Mar 25, 2026
Merged
Conversation
- Add isTrustedOrigin() helper that matches exact strings, '*', or regex literals in the form /pattern/flags (e.g. /^.*\.example\.com$/i) - Use isTrustedOrigin in authenticateOrigin() for --trusted-origins - Add unit tests for isTrustedOrigin and for regex/wildcard in origin auth Made-with: Cursor
Contributor
Author
|
Apologies for raising an AI PR, but I reviewed it thoroughly. We run a Websocket server on the instance and we want to use the proxy to connect to it from several domains. |
code-asher
reviewed
Mar 11, 2026
Member
code-asher
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
- Match --proxy-domain prior art: exact, *, or *.example.com style - Remove full regex support; simpler to type and read Made-with: Cursor
code-asher
approved these changes
Mar 25, 2026
Member
code-asher
left a comment
There was a problem hiding this comment.
Sorry for the delay, but thank you! This is awesome.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds regex support for
--trusted-origins. Entries can be exact host strings,*, or regex literals in the form/pattern/flags(e.g./^.*\.example\.com$/i).Changes
isTrustedOrigin()helper that matches exact strings,*, or regex literals/pattern/flags. Invalid regex entries are treated as non-matching.isTrustedOrigininauthenticateOrigin()for--trusted-origins(VS Code WebSocket and path/domain proxy).isTrustedOriginand for regex/wildcard in the origin auth flow.Use case
Useful when code-server is behind a wildcard subdomain (e.g.
--trusted-origins '/\.your-domain\.com$/') so you don't have to list every subdomain explicitly.Made with Cursor